package com.gjzhao.fmmall.service;

import com.gjzhao.fmmall.entity.Orders;
import com.gjzhao.fmmall.vo.ResponseResultVO;

/**
 * @Description: 订单 Service
 * @Author: gjzhao
 * @Date Created in 2022-01-09 5:43 下午
 */
public interface OrdersService {

    /**
     * 添加订单(自定义实现分布式锁)
     * @param cartIds
     * @param order
     * @return
     */
    ResponseResultVO addOrder(String cartIds, Orders order) throws Exception;


    /**
     * 添加订单(使用redisson框架作为分布式锁-解决分布式并发问题)
     * @param cartIds
     * @param order
     * @return
     * @throws Exception
     */
    ResponseResultVO addOrderByRedisson(String cartIds, Orders order) throws Exception;


    /**
     * 关闭订单
     * @param orderId 订单id
     */
    void closeOrder(String orderId);

    /**
     * 根据用户id和订单状态查询订单分页信息
     * @param userId
     * @param status
     * @param pageNum
     * @param limit
     * @return
     */
    ResponseResultVO listOrdersByUserIdAndStatus(String userId, String status, int pageNum, int limit);

    /**
     * 查询订单(使用pageHelper分页插件进行分页)
     * @param userId
     * @param status
     * @param pageNum
     * @param limit
     * @return
     */
    ResponseResultVO listOrdersByUserIdAndStatusPage(String userId, String status, int pageNum, int limit);

    /**
     * 更新订单状态
     * @param orderId
     * @param status
     * @return
     */
    int updateOrderStatus(String orderId, String status);


    /**
     * 根据订单id更新删除状态
     * @param orderId
     * @param deleteStatus
     * @return
     */
    ResponseResultVO updateOrderDeleteStatus(String orderId, Integer deleteStatus);

}
